package com.sy.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sy.dto.CourseUserPageQueryDTO;
import com.sy.mapper.CourseUserMapper;
import com.sy.pojo.CourseUser;
import com.sy.result.PageResult;
import com.sy.service.CourseUserService;
import com.sy.vo.CourseUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CourseUserServiceImpl extends ServiceImpl<CourseUserMapper, CourseUser> implements CourseUserService {

    @Autowired
    private CourseUserMapper courseUserMapper;

    @Override
    public PageResult findAll(CourseUserPageQueryDTO courseUserPageQueryDTO) {
        Page<CourseUserVO> page=new Page<>(courseUserPageQueryDTO.getPage(),courseUserPageQueryDTO.getPageSize());
        courseUserMapper.findAll(page,courseUserPageQueryDTO.getName());
        return new PageResult(page.getTotal(),page.getRecords());
    }
}
